package com.tangcco.lockwell.service;

import com.tangcco.lockwell.domain.GroupsRelationship;
import com.tangcco.lockwell.domain.User;
import com.tangcco.lockwell.viewmodel.admin.groups.GroupsRelationshipUpdateVM;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface GroupsRelationshipService extends BaseService<GroupsRelationship> {


    int insertSelective(GroupsRelationship record);

    // 动态删除群组用户关系记录的方法，可以根据id或者group_id进行删除操作
    int deleteGroupUserByConditionsSelective(@Param("userId") Integer userId, @Param("groupId") Integer groupId);

/*
    // 动态查询方法，根据传入的多个参数进行灵活查询
    List<GroupsRelationship> findGroupUsersByConditionsSelective(GroupsRelationshipFindVM groupsRelationshipFindVM);
*/

    // 根据群组id 用户id查询信息，
    GroupsRelationship findGroupUsersByConditions(@Param("groupId") Integer groupId, @Param("userId") Integer userId);

    //修改状态和权限
    int updateGroup(GroupsRelationshipUpdateVM groupsRelationshipUpdateVM);

    List<GroupsRelationship> findByGroupIdAndUserType(Integer groupId);

    int deleteByGroupId(Integer groupId);

    List<User> findGroupUsersByGroupIdAndUserType(Integer groupId);


}
